Insert Method

Wintellect PowerCollections

Collapse imageExpand ImageCollapseAll imageExpandAll imageDropDown imageDropDownHover imageCopy imageCopyHover image
[This topic is pre-release documentation and is subject to change in future releases. Blank topics are included as placeholders.]

Inserts a new item at the given index in the Deque. All items at indexes equal to or greater than index move up one index in the Deque.

Namespace: Wintellect.PowerCollections
Assembly:  PowerCollections (in PowerCollections.dll)

Syntax

C#
public void Insert(
	int index,
	T item
)
Visual Basic (Declaration)
Public Sub Insert ( _
	index As Integer, _
	item As T _
)
Visual C++
public:
virtual void Insert (
	int index, 
	T item
) sealed

Parameters

index
Int32
The index in the Deque to insert the item at. After the insertion, the inserted item is located at this index. The front item in the Deque has index 0.
item
T
The item to insert at the given index.

Remarks

The amount of time to insert an item in the Deque is proportional to the distance of index from the closest end of the Deque: O(Min(index, Count - index)). Thus, inserting an item at the front or end of the Deque is always fast; the middle of of the Deque is the slowest place to insert.

Exceptions

ExceptionCondition
System..::ArgumentOutOfRangeExceptionindex is less than zero or greater than Count.

See Also